<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="login.LoginRemote,login.LoginBean,javax.naming.*"%>

<%!
private LoginRemote logger = null;

public void jspInit(){
	try{
		InitialContext ic = new InitialContext();
		logger = (LoginRemote)ic.lookup(LoginBean.RemoteJNDIName);
	}
	catch(Exception ex){ System.out.println("ERREUR!!" + ex.getMessage());}
	
}
	
public void jspDestroy(){
	logger=null;
	
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Mastauc</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<center>
<div style="margin: 1em 300px 0 20px;">

<div id="bandeau"><br/>MASTER AUCTION</div>

<div id="menu">
	<!-- DIV LOGIN -->
	<div id="menuhaut">
	<div id="entete">Login</div>
	<%
	
	String ulogin=request.getParameter("user_login");

	String umdp=request.getParameter("user_mdp");

	//out.println("login: "+ulogin);
	//out.println("mdp: "+umdp);
	
	if(ulogin!=null && umdp!=null && ulogin != "" && umdp != "")
	{
		
	boolean logged = logger.login(ulogin,umdp);
	
	if (logged)
		out.println(logger.getInfos());
	else out.println("aucun utilisateur trouvé");
	
	}
	else
	{
		if (request.getParameter("submitted") != null)
			out.println("champ saisi vide");
	}
	
	if(logger.getLogin() != null)
	{
		out.println(logger.getInfos());
	}
	
	
	
%>
	<form name="fautent" action="index.jsp" method="post">
	<table>
	<tr><td>Login:</td><td> <input type="text" name="user_login"/> </td></tr>
	<tr><td>Mot de passe:</td><td><input type="text" name="user_mdp"/>  </td></tr>
	<tr><td><input type="hidden" name="submitted" value="1"/></td><td><input type="submit" value=" ok " onclick="forms[0].submitted.value=1"/> </td></tr>
	</table>
	</form>
	</div>
	<!-- fin DIV LOGIN -->
	<div id="menubas">
	<div id="entete">Catégories</div>
	cat1<br/>
	cat2<br/>
	cat3<br/>
	</div>

	<div id="menubas2">
	<div id="entete">Recherche</div>
	<br/> 
	<form name="fsearch" action="search.jsp" method="post">
	<input name="keyword" type="text"/> <input type="submit" value="ok"/>
	</form>
	</div>
</div>

<div id="contenu"><div id="entete"> Résultat de la recherche: <% out.println(request.getParameter("keyword")); %> <br/> </div>Enchères en cours: <br/> </div>

<div id="piedpage">-Université Montpellier II - Master Auction </div>

</div>
</center>

</body>
</html>